package com.yidu.best.bond.cashInventory.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yidu.best.bond.cashInventory.dao.CashInventoryDao;
import com.yidu.best.bond.cashInventory.domain.CashInventory;
import com.yidu.best.bond.cashInventory.domain.CashInventoryVo;
import com.yidu.best.bond.cashInventory.service.CashInventoryService;

@Service
public class CashInventoryServiceImpl implements CashInventoryService {
	@Autowired
	private CashInventoryDao cashInventoryDao;

	@Override
	public Map<String, Object> findPageQuery(CashInventoryVo cashInventoryVo) {
		// 调用dao层方法查询数量
		int count = cashInventoryDao.countCashInventory(cashInventoryVo);
		// 计算页码
		int page = (cashInventoryVo.getPage() - 1) * cashInventoryVo.getLimit();
		cashInventoryVo.setPage(page);
		// 调用dao层方法分页查询
		List<CashInventory> capitalTransferList = cashInventoryDao.findPageQuery(cashInventoryVo);
		Map<String, Object> map = new HashMap<String, Object>();
		// 将数据存入map中
		map.put("code", 0);
		map.put("count", count);
		map.put("data", capitalTransferList);
		return map;
	}

}
